home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 February: Tool Chest / Apple Developer CD Series Tool Chest February 1996 (Apple Computer)(1996).iso / Sample Code / Snippets / Development Tools & Languages / DumpSRec / DumpSRec.r < prev    next >
Encoding:
Text File  |  1993-01-18  |  4.3 KB  |  205 lines  |  [TEXT/MPS ]

  1.  
  2. /*
  3.  
  4.         DumpSRec -- an MPW Tool
  5.         
  6.         Required files to build:
  7.             DumpSRec.c
  8.             DumpSRec.r
  9.             DumpSRec.rsrc
  10.             DumpSRec.make
  11.         
  12.         Written by Craig Prouse of Apple Developer Technical Support
  13.         Special thanks to C.K. Haun for the original Commando interface!
  14.         Copyright © 1990-91, Apple Computer, Inc. -- ALL RIGHTS RESERVED
  15.         
  16.         This tool converts an arbitrary Macintosh data file or resource into
  17.         Motorola S-Record format, most likely to assist in downloading code
  18.         and data to EPROM programmers or non-Macintosh target platforms.
  19.         
  20.         Command line syntax:
  21.         
  22.         DumpSRec        # write resource or data in S-Record format
  23.         DumpSRec [option…] fileName  > dump ≥ progress
  24.             -a addr                    # dump to hexadecimal target address (default = 0)
  25.             -b count                # include count data bytes per record (default = 32)
  26.             -h                        # suppress S0 header record
  27.             -nh                        # specify new data for the S0 header record
  28.             -rt type[=id]            # dump resource with this type and id (default is data fork)
  29.             -s1                        # generate S1 records, 2-byte addresses (default)
  30.             -s2                        # generate S2 records, 3-byte addresses
  31.             -s3                        # generate S3 records, 4-byte addresses
  32.             -x addr                    # hexadecimal target execution address (default = 0)
  33.  
  34. */
  35.  
  36.  
  37.  
  38. #include "cmdo.r"
  39. #include "SysTypes.r"
  40.  
  41.  
  42.  
  43. type 'SHDR' {
  44.     unsigned hex integer;
  45.     wstring[252];
  46.     };
  47.  
  48.  
  49.  
  50. resource 'SHDR' (0) {
  51.     0,                    /* S0 record typically has a nil address field  */
  52.     ""                    /* default is no header data */
  53.     };
  54.  
  55.  
  56.  
  57. resource 'vers' (1) {
  58.     0x01,
  59.     0x00,
  60.     development,
  61.     0x03,
  62.     verUs,
  63.     "1.0d3",
  64.     "1.0d3, Copyright © 1990-91 Apple Computer, Inc."
  65.     };
  66.  
  67.  
  68.  
  69. resource 'cmdo' (128, "DumpSRec") {
  70.     {    280,
  71.         "This tool converts either the data fork or a single resource from an "
  72.         "arbitrary file into Motorola S-Record format.",
  73.         
  74.         {    NotDependent {},
  75.             Files {
  76.                 InputFile,
  77.                 RequiredFile {
  78.                     {33, 19, 53, 132},
  79.                     "Dump File…",
  80.                     "",
  81.                     "Select a file to dump. The default data to dump is "
  82.                     "that in the data fork. Enter a resource ID in the appropriate "
  83.                     "field to dump a resource instead."
  84.                     },
  85.                 Additional {
  86.                     "",
  87.                     "",
  88.                     "",
  89.                     "",
  90.                     {}
  91.                     }
  92.                 },
  93.  
  94.             NotDependent {},
  95.             Redirection {
  96.                 StandardOutput,
  97.                 {70, 20}
  98.                 },
  99.  
  100.             NotDependent {},
  101.             Redirection {
  102.                 DiagnosticOutput,
  103.                 {120, 20}
  104.                 },
  105.  
  106.             NotDependent {},
  107.             CheckOption {
  108.                 NotSet,
  109.                 {90, 150, 106, 300},
  110.                 "Suppress S0 Header",
  111.                 "-h",
  112.                 "Suppress generation of the S0 header record."
  113.                 },
  114.  
  115.             Or { {-4} },
  116.             CheckOption {
  117.                 NotSet,
  118.                 {110, 150, 126, 300},
  119.                 "New S0 Data…",
  120.                 "-nh",
  121.                 "Prompt for a new S0 header record. (A dialog allows text entry of "
  122.                 "new data for the S0 record. The text is saved in the system folder "
  123.                 "and will be used until the data is changed again or deleted.)"
  124.                 },
  125.  
  126.             NotDependent {},
  127.             RadioButtons {
  128.                 {    /* 1 */
  129.                     {80, 305, 96, 465},
  130.                     "Generate S1 Records", "", Set,
  131.                     "Generate 2-byte addresses (default).",
  132.                     /* 2 */
  133.                     {100, 305, 116, 465},
  134.                     "Generate S2 Records", "-s2", NotSet,
  135.                     "Generate 3-byte addresses.",
  136.                     /* 3 */
  137.                     {120, 305, 136, 465},
  138.                     "Generate S3 Records", "-s3", NotSet,
  139.                     "Generate 4-byte addresses."
  140.                     }
  141.                 },
  142.  
  143.             NotDependent {},
  144.             RegularEntry {
  145.                 "Resource ID:",
  146.                 {19, 165, 35, 250},
  147.                 {45, 155, 61, 270},
  148.                 "",
  149.                 ignoreCase,
  150.                 "-rt",
  151.                 "Dump resource with this type and id (default = data fork).\n"
  152.                 "Enter in the form \"FONT=12\"."
  153.                 },
  154.  
  155.             NotDependent {},
  156.             RegularEntry {
  157.                 "Load Address:",
  158.                 {19, 283, 35, 377},
  159.                 {45, 295, 61, 365},
  160.                 "",
  161.                 ignoreCase,
  162.                 "-a",
  163.                 "Specify hexadecimal target load address (default = 0)."
  164.                 },
  165.  
  166.             NotDependent {},
  167.             RegularEntry {
  168.                 "Entry Point:",
  169.                 {19, 386, 35, 464},
  170.                 {45, 390, 61, 460},
  171.                 "",
  172.                 ignoreCase,
  173.                 "-x",
  174.                 "Specify hexadecimal target execution address (default = 0)."
  175.                 },
  176.  
  177.             NotDependent {},
  178.             RegularEntry {
  179.                 "Bytes per Line:",
  180.                 {145, 205, 171, 305},
  181.                 {145, 315, 161, 345},
  182.                 "",
  183.                 ignoreCase,
  184.                 "-b",
  185.                 "Specify number of data bytes represented in each S-Line "
  186.                 "(default = 32)."
  187.                 },
  188.  
  189.             Or { {1} },
  190.             DoItButton {},
  191.  
  192.             NotDependent {},
  193.             VersionDialog {
  194.                 VersionString {
  195.                     "1.0d3"
  196.                     },
  197.                 "DumpSRec 1.0d3 by Craig Prouse, "
  198.                 "Copyright © 1990-91 Apple Computer, Inc.\n"
  199.                 "Special thanks to C.K. Haun for the original Commando interface!",
  200.                 0
  201.                 }
  202.             }
  203.         }
  204.     };
  205.